package com.copa.l1814;

/**
 * @author copa
 * @createDate 2023-01-17 10:17
 * @function 暴力法
 */
public class Test1 {

    public int countNicePairs(int[] nums) {
        final int MOD = 1000000007;
        int result = 0;
        int tempSum1;
        int tempSum2;
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                tempSum1 = nums[i] + reverseNum(String.valueOf(nums[j]));
                tempSum2 = nums[j] + reverseNum(String.valueOf(nums[i]));
                if (tempSum1 == tempSum2) {
                    result++;
                }
            }
        }
        return result % MOD;
    }

    public Integer reverseNum(String num) {
        return Integer.parseInt(new StringBuilder()
                .append(num)
                .reverse().toString());
    }

    public static void main(String[] args) {
        //int[] nums = {42,11,1,97};
        int[] nums = {13,10,35,24,76};
        System.out.println(new Test1().countNicePairs(nums));
    }
}
